package com.mysql.main;

import com.mysql.entity.Staffs;
import com.mysql.imples.Staffsimple;
import com.mysql.service.StaffsService;

import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Pattern;

/**
 * 作者:wmx  2025-02-24 19:52
 * 1、功能；staffs-员工程序入口
 **/
public class Staffsmain {
    private static Staffsimple staffsimple = new Staffsimple();
    /**
     * 员工程序
     */
    private static void staffsProcedure(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("=================欢迎来的员工系统=================");
        System.out.println("1、查询 2、添加 3、删除 4、修改 5、查询 6、退出");
        while (true){
            System.out.println("请输入您的操作");
            String out = scanner.nextLine();
            if (out.length() <= 0){
                System.out.println("您的输入有误，请重新");
            }else {
                int outInteget = Integer.parseInt(out);
                if(outInteget == 1){
                    ArrayList<Staffs> staffs = staffsimple.executeDatapreparedStatement();
                    int staffsCount = staffsimple.executeDateCount();
                    System.out.println(staffs.get(0).toString());
                    System.out.println("总数"+staffsCount);
                    StaffsService.StaffsDataRanderPage(staffs,staffsCount);
                }else if(outInteget == 2){
                    StaffsService.StaffsInsertData();
                }else if(outInteget == 3){
                    StaffsService.StaffsDeletetData();
                }else if(outInteget == 4){
                    StaffsService.StaffsUpdateData();
                }else if(outInteget == 5){
                    StaffsService.StaffsUpdateData();
                }else if(outInteget == 6){
                    System.exit(0);
                }else{

                    System.out.println("您的输入有误，请重新");
                }

            }


        }




    }

    public static void main(String[] args) {
        staffsProcedure();
    }
}
